<template>
    <view class="indexs">
        <view :class="'header ' + (banertrue ? 'header_lan' : '')" :style="'padding-top: ' + navH + 'px;'">
            <view class="header_height" :style="'height:' + gaodu + 'px;line-height:' + gaodu + 'px;top:' + gaodutops + 'px;'">
                <view class="index_h_cont3">
                    <view class="index_wenben_img" @tap="jumpzuo">
                        <image :src="imgUrl+'/dzx_img22.png'" mode="widthFix"></image>
                    </view>
                    <view class="index_wenben baise">{{ $t('page_sharing_order_near.Nearest_me') }}</view>
                </view>
            </view>
            <view class="coloe_title">s</view>
        </view>
        <view class="index_banner" style="position: absolute; background: #fff">
            <image :src="imgUrl+'/dzx_img148.png'" mode="widthFix"></image>
        </view>
        <view class="index_center" :style="'padding-top:' + (navH + 50) + 'px;'">
			  <view class="liwozuijin_center">
			      <view class="liwozuijin_item1">
			        <image :src="imgUrl+'/images/dzx_img82.png'"></image>
			        <input type="text" :placeholder="$t('page_sharing_order_near.placeholder1')" @blur="huiche"/>
			      </view>
			      <view class="liwozuijin_item2">
			        <text>{{ $t('page_sharing_order_near.city') }}</text>
			        <image :src="imgUrl+'/images/dzx_img85.png'"></image>
			        <text style="font-weight: 400;">新加坡</text>
			      </view>
			      <view class="liwozuijin_item3">
			        <view class="pintuan_item4_list">
			          <view class="pintuan_item4_cont" :data-id="item.order_id" @tap="goDetail" v-for="(item,index) in list">
			            <view class="pintuan_item4_top">
			              <view class="pintuan_item4_l">
			                <image :src="imgUrl+'/dzx_img27.png'"></image>
			                <text>{{item['title']}}</text>
			              </view>
			              <view class="pintuan_item4_r">
			                <image :src="imgUrl+'/dzx_img76.png'"></image>
			                <text>{{item['distance']}}KM</text>
			              </view>
			            </view>
			            <view class="pintuan_item4_cent" style="margin-top:24rpx;">
			              {{ $t('page_sharing_order_near.Group_size') }}<text>{{item['max_people']}}{{ $t('page_sharing_order_near.renshu') }}</text>
			            </view>
			            <view class="pintuan_item4_cent">
			              {{ $t('page_sharing_order_near.qyzl') }}<text>{{item['min_weight']}}KG</text>
			            </view>
			            <view class="pintuan_item4_cent">
			              {{ $t('page_sharing_order_near.Opening_time') }}<text>{{item['start_time']}}</text>
			            </view>
			            <view class="pintuan_item4_cent">
			              {{ $t('page_sharing_order_near.Receiving_address') }}<text>{{item['address']}}</text>
			            </view>
			            <view class="pintuan_item4_bottom">
			              <view class="pintuan_item4_b1">{{ $t('page_sharing_order_near.haicha') }}<text>{{item['remain_weight']}}</text>kg拼成</view>
			              <view class="pintuan_item4_btns">{{ $t('page_sharing_order_near.pingtuanzhong') }}</view>
			            </view>
			          </view>
			
			          </view>
			          
			          </view>
			
			        </view>
			      </view>
			    </view>

        </view>
    </view>
</template>

<script>
// pages/shouye/shouye_zkc/shouye_zkc.js
const app = getApp();

let request = require('../../utils/require');

export default {
    data() {
        return {
            navH: app.globalData.navHeight,
            gaodu: app.globalData.height,
            gaodutops: app.globalData.top,
			imgUrl:app.globalData.imgUrl,
            height: 0,
            heights: 0,
            currentIndex: 0,
            left: 16,
            false: false,
            width: 0,
            //分页
            page: 1,
            ispage: true,
			list:[],
			country_id:93,
            type: 0,
            //0全部，2待查验，3已查验
            keyword: ''
        };
    }, //滑动显示顶部
    onPageScroll: function (e) {
        if (e.scrollTop > this.navH + 50) {
            this.banertrue= true
        } else {
            this.banertrue= false
        }
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad() {
        var that = this;
		that.getLoction();
    },
    onShow() {
        var that = this;
        that.page= 1
		that.ispage= true
		that.arrlist= []
        
    },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {},
    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {},
    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {},
    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {},
    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {
        if (this.ispage) {
            this.page= this.page + 1
            this.chayanlist(this.type);
        }
    },
    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {},
    methods: {
        huiche(e) {
			console.log(232,'enter');
            this.keyword= e.detail.value
            this.page= 1
            this.ispage= true
            this.list= []
            this.getSharing();
        },
		convertToaddress(data){
			this.poi = data;
			console.log();
		},
		goDetail(e){
			console.log(e,'e')
			uni.navigateTo({
			    url: '/pages/sharing/sharing_order_detail_join?order_id='+e.currentTarget.dataset.id,
			});
		},
        getSharing(){
        	var that = this;
        	var data = {
        	    token: uni.getStorageSync('token'),
        		lat: this.poi.lat,
        		lng: this.poi.lng,
        		country_id: this.country_id,
				page:this.page,
				keyword:this.keyword
        	};
        	request.get(`index.php?s=/api/sharp.index/sharingpage&wxapp_id=` + uni.getStorageSync('web_id'), data).then((res) => {
        	    if (res.data.code == 1) {
        			if (res.data.data.list.length>0){
        			    this.list = res.data.data.list;
        			}
        	    }
        	});
        },
		getLoction(){
			var that = this; 
			uni.getLocation({
				type: 'wgs84',
				success: function (res) {
					that.convertToaddress({'lat':res.latitude,'lng':res.longitude});
					that.getSharing();
					console.log('当前位置的经度：' + res.longitude);
					console.log('当前位置的纬度：' + res.latitude);
				}
			});
		},
		jumpzuo() {
		    uni.navigateBack()
		}
    }
};
</script>
<style>
@import './sharing_order_near.css';
</style>
